<extend name="Layout/ins_base" />
<block name="content">
	{:W('PageHeader/simple',array('name'=>'推送设置','search'=>'N'))}
	<form method='post' id="form_data" class="well form-horizontal">
		<label class="col-sm-2 control-label" >邮件后台接受</label>
		<a onclick="stop_receve_mail()"  class="hidden stop_receve_mail btn btn-sm btn-primary">停止</a>
		<a onclick="start_receve_mail()"  class="start_receve_mail btn btn-sm btn-primary">启动</a>
	</form>
</block>
<block name="js">
	<script type="text/javascript">
		var receve_mail_flag = false;
		var send_wechat_flag = false;

		function start_receve_mail() {
			receve_mail_flag = true;
			$(".start_receve_mail").addClass("hidden");
			$(".stop_receve_mail").removeClass("hidden");

			sendAjax("{:U('receve_mail')}", '', function(data) {
				if (receve_mail_flag) {
					start_receve_mail();
				}
			});
		}

		function stop_receve_mail() {
			$(".start_receve_mail").removeClass("hidden");
			$(".stop_receve_mail").addClass("hidden");
			receve_mail_flag = false;
		}

		function start_send_wechat() {
			send_wechat_flag = true;
			$(".start_send_wechat").addClass("hidden");
			$(".stop_send_wechat").removeClass("hidden");
			sendAjax("{:U('send_wechat')}", '', function(data) {
				if (send_wechat_flag) {
					start_send_wechat();
				}
			});
		}

		function stop_send_wechat() {
			$(".start_send_wechat").removeClass("hidden");
			$(".stop_send_wechat").addClass("hidden");
			send_wechat_flag = false;
		}
	</script>
</block>